package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.service.ITTalentLibraryService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.TTalentLibrary;
import com.ruoyi.service.ITTalentLibraryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 【人才库】Controller
 * 
 * @author ruoyi
 * @date 2024-10-31
 */
@RestController
@RequestMapping("/talent/information")
public class TTalentLibraryController extends BaseController
{
    @Autowired
    private ITTalentLibraryService tTalentLibraryService;

    /**
     * 分页查询数据
     */
//    @PreAuthorize("@ss.hasPermi('system:library:list')")
    @GetMapping("/list")
    public TableDataInfo selectAll( TTalentLibrary tTalentLibrary)
    {
        startPage();
        List<TTalentLibrary> list = tTalentLibraryService.selectTTalentLibraryList(tTalentLibrary);
        return getDataTable(list);
    }


    /**
     * 根据id查询详细人才信息
     */
//    @PreAuthorize("@ss.hasPermi('system:library:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tTalentLibraryService.selectTTalentLibraryById(id));
    }

    /**
     * 新增人才信息
     */
//    @PreAuthorize("@ss.hasPermi('system:library:add')")
    @PostMapping()
    public AjaxResult add(@RequestBody TTalentLibrary tTalentLibrary)
    {
        return toAjax(tTalentLibraryService.insertTTalentLibrary(tTalentLibrary));
    }

    /**
     * 修改【请填写功能名称】
     */
//    @PreAuthorize("@ss.hasPermi('system:library:edit')")
    @PutMapping
    public AjaxResult edit(@RequestBody TTalentLibrary tTalentLibrary)
    {
        return toAjax(tTalentLibraryService.updateTTalentLibrary(tTalentLibrary));
    }

    /**
     * 删除【请填写功能名称】
     */
//    @PreAuthorize("@ss.hasPermi('system:library:remove')")
//    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult deleteIds(@PathVariable Long[] ids)
    {
        return toAjax(tTalentLibraryService.deleteTTalentLibraryByIds(ids));
    }

}
